function [similarity,eigenvalue_timeprofile] = sim_timeprofile_operator(raw_syn_a, raw_syn_b,correspond)
%SIM_OPERATOR Summary of this function goes here
%   syn_a, syn_b are both structs
%   syn_a.C
%   syn_a.U, dimensionality of U = # of synergy components
%   syn_a.D, syn_a.EMG, syn_a.VAF, syn_a.NUM_TRIAL, syn_a.NUM_COMPONENT

syn_a = average_c(raw_syn_a);
syn_b = average_c(raw_syn_b);

% eigenvalue
[~,~,latent,~] = pca(syn_b.C);
eigenvalue_timeprofile = latent/sum(latent);

similarity = zeros(syn_a.NUM_COMPONENT,1);

for i = 1:1:syn_a.NUM_COMPONENT
    
    normal = correspond(i).normal_vector_num;
    subject = correspond(i).subject_vector_num;
    inner_prod = sum(syn_a.C_ave(:,normal) .* syn_b.C_ave(:,subject));
    similarity(i) = inner_prod/(norm(syn_a.C_ave(:,normal))*norm(syn_b.C_ave(:,subject)));
end

end
